package com.example.liuweather.android.util;

import okhttp3.OkHttpClient;
import okhttp3.Request;

public class HttpUtil {
    // 向服务器发送请求，响应的数据会回调到onResponse()方法中
    public static void sendOkHttpRequest(String address, okhttp3.Callback callback) {
        OkHttpClient client = new OkHttpClient();
        Request request = new Request.Builder().url(address).build();
        // 发送请求获取服务器返回的数据,返回的数据在参数的回调函数中
        client.newCall(request).enqueue(callback);
    }
}
